from django.contrib.syndication.views import Feed
from .models import Article


class RssFeed(Feed):
    title = '大鹌鹑的博客 RSS'
    link = 'feeds/posts/'
    description = 'RSS feed - blog posts'

    def items(self):
        return Article.objects.order_by('-date_time')

    def item_title(self, item):
        return item.title

    def item_pubdate(self, item):
        return item.date_time

    def item_description(self, item):
        return item.content
